﻿
import flash.filters.GlowFilter;
class Sillyt.Effec.Glow extends Silly.Effect.EffectTween
{
	private var _alpha:Number;
	//光晕的透明度 0 到 1 
	private var _color:Number;
	//光晕的颜色
	private var _inner:Boolean;
	//是否为内部发光，true是内部发光
	private var _knockout:Boolean;
	//是否为挖空效果，true 为挖空
	private var _strength:Number;
	//印记的颜色强度 ，该值越高，印记的颜色越深，而且发光与背景之间的对比度也越强。有效值为 0 到 255
	public function Glow (mc:MovieClip, startGlowX:Number, endGlowX:Number, startGlowY:Number, endGlowY:Number, duration:Number)
	{
		this._aim = mc;
		this._startX = startGlowX;
		this._endX = endGlowX;
		this._startY = startGlowY;
		this._endY = endGlowY;
		this._currentX = 0;
		this._currentY = 0;
		this._duration = Math.round (duration / 2);
		this._alpha = 1;
		this._color = 0xFF0000;
		this._inner = false;
		this._knockout = false;
		this._strength = 10;
		effectToMc (this._aim, this._startX, this._startY);
	}
	public function effectToMc (mc:MovieClip, xNum:Number, yNum:Number)
	{
		if (typeof (mc) == "movieclip") {
			this._aim = mc;
			//初试化目标
		}
		xNum == undefined ? xNum = 10 : [];
		yNum == undefined ? yNum = 10 : [];
		var filter:GlowFilter = new GlowFilter (this._color, this._alpha, xNum, yNum, this._strength, this._quality, this._inner, this._knockout);
		this._aim.filters = new Array (filter);
		//转移到数组并附加到mc显示目标  
	}
	public function set alpha (num:Number):Void
	{
		this._alpha = num;
	}
	public function get alpha ():Number
	{
		return this._alpha;
	}
	public function set color (num:Number):Void
	{
		this._color = num;
	}
	public function get color ():Number
	{
		return this._color;
	}
	public function set inner (b:Boolean):Void
	{
		this._inner = b;
	}
	public function get inner ():Boolean
	{
		return this._inner;
	}
	public function set knockout (b:Boolean):Void
	{
		this._knockout = b;
	}
	public function get knockout ():Boolean
	{
		return this._knockout;
	}
	public function set strength (num:Number):Void
	{
		this._strength = num;
	}
	public function get strength ():Number
	{
		return this._strength;
	}
}
